<template>
  <div class="sys-main admin_right_con">
    <div class="admin_right" style="margin-left:0;">
      <div class="admin_right_con">
        <div class="main14">
          <div class="nav clearfix">
            <a class="pull-left active">内容设置</a>
            <a class="pull-left" style="display:none">其他设置</a>
          </div>
          <div class="con_box">
            <el-form ref="form" :model="form" label-width="80px">
              <el-form-item label="联系">
                <el-input style="width:300px;"   :autosize="{ minRows: 10}" v-model="form.connect" type="textarea" />
              </el-form-item>
              <el-form-item label="版权">
                <el-input style="width:300px;" v-model="form.copyright" />
              </el-form-item>
              <el-form-item label="二维码">
                <ImageUpload v-model="form.qrCode" />
              </el-form-item>
              <el-form-item style="margin-top:100px;">
                <el-button type="primary" @click="onSubmit">保存</el-button>
              </el-form-item>
            </el-form>
          </div>
        </div>
      </div>
    </div>
    <!-- // 内容设置 -->
  </div>
</template>

<script>
import ImageUpload from "../../components/ImageUpload/index";
import { saveConfig, getConfig } from "@/api/cms/sys";
export default {
  name: "MangerSysInfo",
  components: {
    ImageUpload
  },
  data() {
    return {
      form: {}
    };
  },
  created() {
    getConfig().then(res => {
      this.form = res.data;
    });
  },
  methods: {
    onSubmit() {
      if (!this.form.connect) {
        this.$message.error("请填写联系方式");
        return;
      }
      if (!this.form.copyright) {
        this.$message.error("请填写版权");
        return;
      }
      if (!this.form.qrCode) {
        this.$message.error("请上传二维码");
        return;
      }
      saveConfig(this.form).then(res => {
        this.$message.success("保存成功");
      });
    }
  }
};
</script>

<style lang="scss" scoped></style>
